home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / libs / objeas3a / workshop / fileio.cpp < prev    next >
C/C++ Source or Header  |  1994-05-18  |  38KB  |  1,324 lines

  1. #include "d:\gui\gui.h"
  2. #include "workshop.h"
  3. #include <conio.h>
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6. #include <io.h>
  7.  
  8. //*********************************************************************
  9. //        FUNCTION PROTOTYPES
  10. //*********************************************************************
  11.  
  12. int save_all_info();
  13. int read_new_info();
  14. void clear_all_info(int);
  15.  
  16. extern void showmem();
  17. extern redraw_screen();
  18.  
  19. //*********************************************************************
  20. //        GLOBAL VARIABLES
  21. //*********************************************************************
  22.  
  23. extern panelrec *panelroot;
  24. extern panelrec *currentpanel;
  25. extern int numpanels;
  26.  
  27. extern bevelrec *bevelroot;
  28. extern bevelrec *currentbevel;
  29. extern int numbevels;
  30.  
  31. extern checkboxrec *checkboxroot;
  32. extern checkboxrec *currentcheckbox;
  33. extern int numcheckboxes;
  34.  
  35. extern radiorec *radioroot;
  36. extern radiorec *currentradio;
  37. extern int numradios;
  38.  
  39. extern iconrec *iconroot;
  40. extern iconrec *currenticon;
  41. extern int numicons;
  42.  
  43. extern stringrec *stringroot;
  44. extern stringrec *currentstring;
  45. extern int numstrings;
  46.  
  47. extern buttonrec *buttonroot;
  48. extern buttonrec *currentbutton;
  49. extern int numbuttons;
  50.  
  51. extern Line line_info[100];
  52. extern int numlines;
  53.  
  54. extern textrec *textroot;
  55. extern textrec *currenttext;
  56. extern int numtexts;
  57.  
  58. extern Mcursor the_mouse;
  59.  
  60. //*********************************************************************
  61. //        SAVE_ALL_INFO
  62. //*********************************************************************
  63.  
  64.  
  65. //**************************************************************************
  66. //        FIRST PORTION OF THIS CODE SAVES THE .COD FILE INFORMATION
  67. //**************************************************************************
  68.  
  69. int save_all_info()
  70. {
  71.     FILE *fp;
  72.     char buffer[20];
  73.     int i;
  74.     char ULX[4],ULY[4],W[4],H[4],L[4],LRX[4],LRY[4],COL[4],THICKNESS[4];
  75.     char codename[MAXPATH],scrname[MAXPATH],filename[MAXPATH];
  76.     dirbox far *db;
  77.  
  78.     db=new dirbox;
  79.     db->set_mask("*.scr");
  80.     strcpy(filename,db->trackdir());
  81.     delete db;
  82.  
  83.     for(i=0;i<strlen(filename);i++)
  84.         if(filename[i]=='.') {
  85.             filename[i]=0;
  86.             break;
  87.             }
  88.     strcpy(codename,filename);
  89.     strcat(codename,".cod");
  90.     strcpy(scrname,filename);
  91.     strcat(scrname,".scr");
  92.  
  93.     if((access(scrname,0))==0) {
  94.         printf("\a");
  95.         if((Messagebox("File Exists!  Overwrite?",MB_YESNO))==ID_NO)
  96.             return 0;
  97.         }
  98.     fp=fopen(codename,"wt");
  99.     if(!fp)
  100.         return 0;
  101.  
  102. //**************************************************************************
  103. //BEVELS
  104. savebevels:
  105.     if(bevelroot==(bevelrec *)NULL)
  106.         goto savepanels;
  107.     currentbevel=bevelroot;
  108.  
  109.     while(currentbevel!=NULL) {
  110.  
  111. //WRITE DECLARATION
  112.         strcpy(buffer,"Bevel");
  113.         fwrite(buffer,strlen(buffer),1,fp);
  114.         strcpy(buffer," ");
  115.         fwrite(buffer,strlen(buffer),1,fp);
  116.         strcpy(buffer,currentbevel->name);
  117.         fwrite(buffer,strlen(buffer),1,fp);
  118.         strcpy(buffer,";\n");
  119.         fwrite(buffer,strlen(buffer),1,fp);
  120.  
  121. //WRITE DEFINITION
  122.         strcpy(buffer,currentbevel->name);
  123.         fwrite(buffer,strlen(buffer),1,fp);
  124.         strcpy(buffer,".init(");
  125.         fwrite(buffer,strlen(buffer),1,fp);
  126.         strcpy(buffer,(itoa(currentbevel->bevel->Getx(),ULX,10)));
  127.         fwrite(buffer,strlen(buffer),1,fp);
  128.         strcpy(buffer,",");
  129.         fwrite(buffer,strlen(buffer),1,fp);
  130.         strcpy(buffer,(itoa(currentbevel->bevel->Gety(),ULY,10)));
  131.         fwrite(buffer,strlen(buffer),1,fp);
  132.         strcpy(buffer,",");
  133.         fwrite(buffer,strlen(buffer),1,fp);
  134.         strcpy(buffer,(itoa(currentbevel->bevel->Getw(),W,10)));
  135.         fwrite(buffer,strlen(buffer),1,fp);
  136.         strcpy(buffer,",");
  137.         fwrite(buffer,strlen(buffer),1,fp);
  138.         strcpy(buffer,(itoa(currentbevel->bevel->Geth(),H,10)));
  139.         fwrite(buffer,strlen(buffer),1,fp);
  140.         strcpy(buffer,",");
  141.         fwrite(buffer,strlen(buffer),1,fp);
  142.         if(!currentbevel->bevel->Getthick())
  143.             strcpy(buffer,"THICK");
  144.         else
  145.             strcpy(buffer,"THIN");
  146.         fwrite(buffer,strlen(buffer),1,fp);
  147.         strcpy(buffer,");\n");
  148.         fwrite(buffer,strlen(buffer),1,fp);
  149.  
  150.         currentbevel=currentbevel->next;
  151.         }
  152.  
  153. //WRITE SHOW
  154.     currentbevel=bevelroot;
  155.     while(currentbevel->next!=NULL) {
  156.         strcpy(buffer,currentbevel->name);
  157.         fwrite(buffer,strlen(buffer),1,fp);
  158.         strcpy(buffer,".show();\n");
  159.         fwrite(buffer,strlen(buffer),1,fp);
  160.         currentbevel=currentbevel->next;
  161.         }
  162.     if(bevelroot!=(bevelrec *)NULL) {
  163.         strcpy(buffer,"\n");
  164.         fwrite(buffer,strlen(buffer),1,fp);
  165.         }
  166.  
  167. //**************************************************************************
  168. //PANELS
  169. savepanels:
  170.     if(panelroot==(panelrec *)NULL)
  171.         goto savebuttons;
  172.     currentpanel=panelroot;
  173.  
  174.     while(currentpanel!=NULL) {
  175.  
  176. //WRITE DECLARATION
  177.         strcpy(buffer,"Panel");
  178.         fwrite(buffer,strlen(buffer),1,fp);
  179.         strcpy(buffer," ");
  180.         fwrite(buffer,strlen(buffer),1,fp);
  181.         strcpy(buffer,currentpanel->name);
  182.         fwrite(buffer,strlen(buffer),1,fp);
  183.         strcpy(buffer,";\n");
  184.         fwrite(buffer,strlen(buffer),1,fp);
  185.  
  186. //WRITE DEFINITION
  187.         strcpy(buffer,currentpanel->name);
  188.         fwrite(buffer,strlen(buffer),1,fp);
  189.         strcpy(buffer,".init(");
  190.         fwrite(buffer,strlen(buffer),1,fp);
  191.         strcpy(buffer,(itoa(currentpanel->panel->Getx(),ULX,10)));
  192.         fwrite(buffer,strlen(buffer),1,fp);
  193.         strcpy(buffer,",");
  194.         fwrite(buffer,strlen(buffer),1,fp);
  195.         strcpy(buffer,(itoa(currentpanel->panel->Gety(),ULY,10)));
  196.         fwrite(buffer,strlen(buffer),1,fp);
  197.         strcpy(buffer,",");
  198.         fwrite(buffer,strlen(buffer),1,fp);
  199.         strcpy(buffer,(itoa(currentpanel->panel->Getw(),W,10)));
  200.         fwrite(buffer,strlen(buffer),1,fp);
  201.         strcpy(buffer,",");
  202.         fwrite(buffer,strlen(buffer),1,fp);
  203.         strcpy(buffer,(itoa(currentpanel->panel->Geth(),H,10)));
  204.         fwrite(buffer,strlen(buffer),1,fp);
  205.         strcpy(buffer,",");
  206.         fwrite(buffer,strlen(buffer),1,fp);
  207.         if(!currentpanel->panel->Getin())
  208.             strcpy(buffer,"IN");
  209.         else
  210.             strcpy(buffer,"OUT");
  211.         fwrite(buffer,strlen(buffer),1,fp);
  212.         strcpy(buffer,",");
  213.         fwrite(buffer,strlen(buffer),1,fp);
  214.         if(!currentpanel->panel->Getthick())
  215.             strcpy(buffer,"THICK");
  216.         else
  217.             strcpy(buffer,"THIN");
  218.         fwrite(buffer,strlen(buffer),1,fp);
  219.         strcpy(buffer,");\n");
  220.         fwrite(buffer,strlen(buffer),1,fp);
  221.  
  222.         currentpanel=currentpanel->next;
  223.         }
  224.  
  225. //WRITE SHOW
  226.     currentpanel=panelroot;
  227.     while(currentpanel->next!=NULL) {
  228.         strcpy(buffer,currentpanel->name);
  229.         fwrite(buffer,strlen(buffer),1,fp);
  230.         strcpy(buffer,".show();\n");
  231.         fwrite(buffer,strlen(buffer),1,fp);
  232.         currentpanel=currentpanel->next;
  233.         }
  234.     if(panelroot!=(panelrec *)NULL) {
  235.         strcpy(buffer,"\n");
  236.         fwrite(buffer,strlen(buffer),1,fp);
  237.         }
  238.  
  239. //**************************************************************************
  240. //BUTTONS
  241. savebuttons:
  242.     if(buttonroot==NULL)
  243.         goto savegstrings;
  244.     currentbutton=buttonroot;
  245.     while(currentbutton!=NULL) {
  246.  
  247. //WRITE DECLARATION
  248.         strcpy(buffer,"Button");
  249.         fwrite(buffer,strlen(buffer),1,fp);
  250.         strcpy(buffer," ");
  251.         fwrite(buffer,strlen(buffer),1,fp);
  252.         strcpy(buffer,currentbutton->name);
  253.         fwrite(buffer,strlen(buffer),1,fp);
  254.         strcpy(buffer,";\n");
  255.         fwrite(buffer,strlen(buffer),1,fp);
  256.  
  257. //WRITE DEFINITION
  258.         strcpy(buffer,currentbutton->name);
  259.         fwrite(buffer,strlen(buffer),1,fp);
  260.         strcpy(buffer,".init(");
  261.         fwrite(buffer,strlen(buffer),1,fp);
  262.         strcpy(buffer,(itoa(currentbutton->button->Getx(),ULX,10)));
  263.         fwrite(buffer,strlen(buffer),1,fp);
  264.         strcpy(buffer,",");
  265.         fwrite(buffer,strlen(buffer),1,fp);
  266.         strcpy(buffer,(itoa(currentbutton->button->Gety(),ULY,10)));
  267.         fwrite(buffer,strlen(buffer),1,fp);
  268.         strcpy(buffer,",");
  269.         fwrite(buffer,strlen(buffer),1,fp);
  270.         strcpy(buffer,"\"");
  271.         fwrite(buffer,strlen(buffer),1,fp);
  272.         strcpy(buffer,currentbutton->button->Getcontents());
  273.         fwrite(buffer,strlen(buffer),1,fp);
  274.         strcpy(buffer,"\"");
  275.         fwrite(buffer,strlen(buffer),1,fp);
  276.         strcpy(buffer,",");
  277.         fwrite(buffer,strlen(buffer),1,fp);
  278.         if(currentbutton->button->Getformat())
  279.             strcpy(buffer,"IMAGE");
  280.         else
  281.             strcpy(buffer,"TEXT");
  282.         fwrite(buffer,strlen(buffer),1,fp);
  283.         strcpy(buffer,");\n");
  284.         fwrite(buffer,strlen(buffer),1,fp);
  285.  
  286.         currentbutton=currentbutton->next;
  287.         }
  288.  
  289. //WRITE SHOW
  290.     currentbutton=buttonroot;
  291.     while(currentbutton!=NULL) {
  292.         strcpy(buffer,currentbutton->name);
  293.         fwrite(buffer,strlen(buffer),1,fp);
  294.         strcpy(buffer,".show();\n");
  295.         fwrite(buffer,strlen(buffer),1,fp);
  296.         currentbutton=currentbutton->next;
  297.         }
  298.     if(buttonroot!=NULL) {
  299.         strcpy(buffer,"\n");
  300.         fwrite(buffer,strlen(buffer),1,fp);
  301.         }
  302.  
  303. //**************************************************************************
  304. //GSTRINGS
  305. savegstrings:
  306.     if(stringroot==NULL)
  307.         goto savegradios;
  308.     currentstring=stringroot;
  309.     while(currentstring!=NULL) {
  310.  
  311. //WRITE DECLARATION
  312.         strcpy(buffer,"Gstring");
  313.         fwrite(buffer,strlen(buffer),1,fp);
  314.         strcpy(buffer," ");
  315.         fwrite(buffer,strlen(buffer),1,fp);
  316.         strcpy(buffer,currentstring->name);
  317.         fwrite(buffer,strlen(buffer),1,fp);
  318.         strcpy(buffer,";\n");
  319.         fwrite(buffer,strlen(buffer),1,fp);
  320.  
  321. //WRITE DEFINITION
  322.         strcpy(buffer,currentstring->name);
  323.         fwrite(buffer,strlen(buffer),1,fp);
  324.         strcpy(buffer,".init(");
  325.         fwrite(buffer,strlen(buffer),1,fp);
  326.         strcpy(buffer,(itoa(currentstring->string->Getx(),ULX,10)));
  327.         fwrite(buffer,strlen(buffer),1,fp);
  328.         strcpy(buffer,",");
  329.         fwrite(buffer,strlen(buffer),1,fp);
  330.         strcpy(buffer,(itoa(currentstring->string->Gety(),ULY,10)));
  331.         fwrite(buffer,strlen(buffer),1,fp);
  332.         strcpy(buffer,",");
  333.         fwrite(buffer,strlen(buffer),1,fp);
  334.  
  335.         strcpy(buffer,itoa(currentstring->string->Getlength(),L,10));
  336.         fwrite(buffer,strlen(buffer),1,fp);
  337.         strcpy(buffer,",");
  338.         fwrite(buffer,strlen(buffer),1,fp);
  339.         if(currentstring->string->is_ucase())
  340.             strcpy(buffer,"1");
  341.         else
  342.             strcpy(buffer,"0");
  343.         fwrite(buffer,strlen(buffer),1,fp);
  344.         strcpy(buffer,");\n");
  345.         fwrite(buffer,strlen(buffer),1,fp);
  346.  
  347.         currentstring=currentstring->next;
  348.         }
  349.  
  350. //WRITE SHOW
  351.     currentstring=stringroot;
  352.     while(currentstring!=NULL) {
  353.         strcpy(buffer,currentstring->name);
  354.         fwrite(buffer,strlen(buffer),1,fp);
  355.         strcpy(buffer,".show();\n");
  356.         fwrite(buffer,strlen(buffer),1,fp);
  357.         currentstring=currentstring->next;
  358.         }
  359.     if(stringroot!=NULL) {
  360.         strcpy(buffer,"\n");
  361.         fwrite(buffer,strlen(buffer),1,fp);
  362.         }
  363.  
  364. //**************************************************************************
  365. //GRADIOS
  366. savegradios:
  367.     if(radioroot==NULL)
  368.         goto savegcheckboxes;
  369.     currentradio=radioroot;
  370.     while(currentradio!=NULL) {
  371.  
  372. //WRITE DECLARATION
  373.         strcpy(buffer,"Gradio");
  374.         fwrite(buffer,strlen(buffer),1,fp);
  375.         strcpy(buffer," ");
  376.         fwrite(buffer,strlen(buffer),1,fp);
  377.         strcpy(buffer,currentradio->name);
  378.         fwrite(buffer,strlen(buffer),1,fp);
  379.         strcpy(buffer,";\n");
  380.         fwrite(buffer,strlen(buffer),1,fp);
  381.  
  382. //WRITE DEFINITION
  383.         strcpy(buffer,currentradio->name);
  384.         fwrite(buffer,strlen(buffer),1,fp);
  385.         strcpy(buffer,".init(");
  386.         fwrite(buffer,strlen(buffer),1,fp);
  387.         strcpy(buffer,(itoa(currentradio->radio->Getx(),ULX,10)));
  388.         fwrite(buffer,strlen(buffer),1,fp);
  389.         strcpy(buffer,",");
  390.         fwrite(buffer,strlen(buffer),1,fp);
  391.         strcpy(buffer,(itoa(currentradio->radio->Gety(),ULY,10)));
  392.         fwrite(buffer,strlen(buffer),1,fp);
  393.         strcpy(buffer,",");
  394.         fwrite(buffer,strlen(buffer),1,fp);
  395.  
  396.         strcpy(buffer,"\"");
  397.         fwrite(buffer,strlen(buffer),1,fp);
  398.         strcpy(buffer,currentradio->radio->Gettext());
  399.         fwrite(buffer,strlen(buffer),1,fp);
  400.         strcpy(buffer,"\"");
  401.         fwrite(buffer,strlen(buffer),1,fp);
  402.         strcpy(buffer,");\n");
  403.         fwrite(buffer,strlen(buffer),1,fp);
  404.  
  405.         currentradio=currentradio->next;
  406.         }
  407.  
  408. //WRITE SHOW
  409.     currentradio=radioroot;
  410.     while(currentradio!=NULL) {
  411.         strcpy(buffer,currentradio->name);
  412.         fwrite(buffer,strlen(buffer),1,fp);
  413.         strcpy(buffer,".show();\n");
  414.         fwrite(buffer,strlen(buffer),1,fp);
  415.         currentradio=currentradio->next;
  416.         }
  417.     if(radioroot!=NULL) {
  418.         strcpy(buffer,"\n");
  419.         fwrite(buffer,strlen(buffer),1,fp);
  420.         }
  421.  
  422. //**************************************************************************
  423. //GCHECKBOXES
  424. savegcheckboxes:
  425.     if(checkboxroot==NULL)
  426.         goto saveicons;
  427.     currentcheckbox=checkboxroot;
  428.     while(currentcheckbox!=NULL) {
  429.  
  430. //WRITE DECLARATION
  431.         strcpy(buffer,"Gcheckbox");
  432.         fwrite(buffer,strlen(buffer),1,fp);
  433.         strcpy(buffer," ");
  434.         fwrite(buffer,strlen(buffer),1,fp);
  435.         strcpy(buffer,currentcheckbox->name);
  436.         fwrite(buffer,strlen(buffer),1,fp);
  437.         strcpy(buffer,";\n");
  438.         fwrite(buffer,strlen(buffer),1,fp);
  439.  
  440. //WRITE DEFINITION
  441.         strcpy(buffer,currentcheckbox->name);
  442.         fwrite(buffer,strlen(buffer),1,fp);
  443.         strcpy(buffer,".init(");
  444.         fwrite(buffer,strlen(buffer),1,fp);
  445.         strcpy(buffer,(itoa(currentcheckbox->checkbox->Getx(),ULX,10)));
  446.         fwrite(buffer,strlen(buffer),1,fp);
  447.         strcpy(buffer,",");
  448.         fwrite(buffer,strlen(buffer),1,fp);
  449.         strcpy(buffer,(itoa(currentcheckbox->checkbox->Gety(),ULY,10)));
  450.         fwrite(buffer,strlen(buffer),1,fp);
  451.         strcpy(buffer,",");
  452.         fwrite(buffer,strlen(buffer),1,fp);
  453.  
  454.         strcpy(buffer,"\"");
  455.         fwrite(buffer,strlen(buffer),1,fp);
  456.         strcpy(buffer,currentcheckbox->checkbox->Gettext());
  457.         fwrite(buffer,strlen(buffer),1,fp);
  458.         strcpy(buffer,"\"");
  459.         fwrite(buffer,strlen(buffer),1,fp);
  460.         strcpy(buffer,");\n");
  461.         fwrite(buffer,strlen(buffer),1,fp);
  462.  
  463.         currentcheckbox=currentcheckbox->next;
  464.         }
  465.  
  466. //WRITE SHOW
  467.     currentcheckbox=checkboxroot;
  468.     while(currentcheckbox!=NULL) {
  469.         strcpy(buffer,currentcheckbox->name);
  470.         fwrite(buffer,strlen(buffer),1,fp);
  471.         strcpy(buffer,".show();\n");
  472.         fwrite(buffer,strlen(buffer),1,fp);
  473.         currentcheckbox=currentcheckbox->next;
  474.         }
  475.     if(checkboxroot!=NULL) {
  476.         strcpy(buffer,"\n");
  477.         fwrite(buffer,strlen(buffer),1,fp);
  478.         }
  479.  
  480. //**************************************************************************
  481. //ICONS
  482. saveicons:
  483.     if(iconroot==NULL)
  484.         goto savegtexts;
  485.     currenticon=iconroot;
  486.     while(currenticon!=NULL) {
  487.  
  488. //WRITE DECLARATION
  489.         strcpy(buffer,"Icon");
  490.         fwrite(buffer,strlen(buffer),1,fp);
  491.         strcpy(buffer," ");
  492.         fwrite(buffer,strlen(buffer),1,fp);
  493.         strcpy(buffer,currenticon->name);
  494.         fwrite(buffer,strlen(buffer),1,fp);
  495.         strcpy(buffer,";\n");
  496.         fwrite(buffer,strlen(buffer),1,fp);
  497.  
  498. //WRITE DEFINITION
  499.         strcpy(buffer,currenticon->name);
  500.         fwrite(buffer,strlen(buffer),1,fp);
  501.         strcpy(buffer,".init(");
  502.         fwrite(buffer,strlen(buffer),1,fp);
  503.         strcpy(buffer,(itoa(currenticon->icon->Getx(),ULX,10)));
  504.         fwrite(buffer,strlen(buffer),1,fp);
  505.         strcpy(buffer,",");
  506.         fwrite(buffer,strlen(buffer),1,fp);
  507.         strcpy(buffer,(itoa(currenticon->icon->Gety(),ULY,10)));
  508.         fwrite(buffer,strlen(buffer),1,fp);
  509.         strcpy(buffer,",");
  510.         fwrite(buffer,strlen(buffer),1,fp);
  511.         strcpy(buffer,"\"");
  512.         fwrite(buffer,strlen(buffer),1,fp);
  513.         strcpy(buffer,currenticon->icon->Getfilename());
  514.         fwrite(buffer,strlen(buffer),1,fp);
  515.         strcpy(buffer,"\"");
  516.         fwrite(buffer,strlen(buffer),1,fp);
  517.         strcpy(buffer,");\n");
  518.         fwrite(buffer,strlen(buffer),1,fp);
  519.         currenticon=currenticon->next;
  520.         }
  521.  
  522. //WRITE SHOW
  523.     currenticon=iconroot;
  524.     while(currenticon!=NULL) {
  525.         strcpy(buffer,currenticon->name);
  526.         fwrite(buffer,strlen(buffer),1,fp);
  527.         strcpy(buffer,".show();\n");
  528.         fwrite(buffer,strlen(buffer),1,fp);
  529.         currenticon=currenticon->next;
  530.         }
  531.     if(iconroot!=NULL) {
  532.         strcpy(buffer,"\n");
  533.         fwrite(buffer,strlen(buffer),1,fp);
  534.         }
  535.  
  536. //**************************************************************************
  537. //GTEXTS
  538. savegtexts:
  539.     char FGD[4],BGD[4],SIZE[4];
  540.     if(textroot==NULL)
  541.         goto savelines;
  542.     currenttext=textroot;
  543.     while(currenttext!=NULL) {
  544.  
  545. //WRITE DECLARATION
  546.         strcpy(buffer,"Gtext");
  547.         fwrite(buffer,strlen(buffer),1,fp);
  548.         strcpy(buffer," ");
  549.         fwrite(buffer,strlen(buffer),1,fp);
  550.         strcpy(buffer,currenttext->name);
  551.         fwrite(buffer,strlen(buffer),1,fp);
  552.         strcpy(buffer,";\n");
  553.         fwrite(buffer,strlen(buffer),1,fp);
  554.  
  555. //WRITE DEFINITION
  556.         strcpy(buffer,currenttext->name);
  557.         fwrite(buffer,strlen(buffer),1,fp);
  558.         strcpy(buffer,".init(");
  559.         fwrite(buffer,strlen(buffer),1,fp);
  560.         strcpy(buffer,(itoa(currenttext->text->Getx(),ULX,10)));
  561.         fwrite(buffer,strlen(buffer),1,fp);
  562.         strcpy(buffer,",");
  563.         fwrite(buffer,strlen(buffer),1,fp);
  564.         strcpy(buffer,(itoa(currenttext->text->Gety(),ULY,10)));
  565.         fwrite(buffer,strlen(buffer),1,fp);
  566.         strcpy(buffer,",");
  567.         fwrite(buffer,strlen(buffer),1,fp);
  568.         strcpy(buffer,"\"");
  569.         fwrite(buffer,strlen(buffer),1,fp);
  570.         strcpy(buffer,currenttext->text->Gettext());
  571.         fwrite(buffer,strlen(buffer),1,fp);
  572.         strcpy(buffer,"\"");
  573.         fwrite(buffer,strlen(buffer),1,fp);
  574.         strcpy(buffer,",");
  575.         fwrite(buffer,strlen(buffer),1,fp);
  576.  
  577.         strcpy(buffer,itoa(currenttext->text->Getfgd(),FGD,10));
  578.         fwrite(buffer,strlen(buffer),1,fp);
  579.         strcpy(buffer,",");
  580.         fwrite(buffer,strlen(buffer),1,fp);
  581.         strcpy(buffer,itoa(currenttext->text->Getbgd(),BGD,10));
  582.         fwrite(buffer,strlen(buffer),1,fp);
  583.         strcpy(buffer,",");
  584.         fwrite(buffer,strlen(buffer),1,fp);
  585.         strcpy(buffer,itoa(currenttext->text->Getsize(),SIZE,10));
  586.         fwrite(buffer,strlen(buffer),1,fp);
  587.         strcpy(buffer,");\n");
  588.         fwrite(buffer,strlen(buffer),1,fp);
  589.  
  590.         currenttext=currenttext->next;
  591.         }
  592.  
  593. //WRITE SHOW
  594.     currenttext=textroot;
  595.     while(currenttext!=NULL) {
  596.         strcpy(buffer,currenttext->name);
  597.         fwrite(buffer,strlen(buffer),1,fp);
  598.         strcpy(buffer,".show();\n");
  599.         fwrite(buffer,strlen(buffer),1,fp);
  600.         currenttext=currenttext->next;
  601.         }
  602.     if(textroot!=NULL) {
  603.         strcpy(buffer,"\n");
  604.         fwrite(buffer,strlen(buffer),1,fp);
  605.         }
  606.  
  607. //**************************************************************************
  608. //LINES
  609. savelines:
  610.     char NL[4];
  611.     char I[4];
  612.  
  613.     if(numlines>0) {
  614.  
  615. //WRITE DECLARATION
  616.         strcpy(buffer,"Line");
  617.         fwrite(buffer,strlen(buffer),1,fp);
  618.         strcpy(buffer," ");
  619.         fwrite(buffer,strlen(buffer),1,fp);
  620.         strcpy(buffer,"lines[");
  621.         fwrite(buffer,strlen(buffer),1,fp);
  622.         strcpy(buffer,itoa(numlines,NL,10));
  623.         fwrite(buffer,strlen(buffer),1,fp);
  624.         strcpy(buffer,"];\n");
  625.         fwrite(buffer,strlen(buffer),1,fp);
  626.  
  627. //WRITE DEFINITION
  628.     for(i=0;i<numlines;i++) {
  629.         strcpy(buffer,"lines[");
  630.         fwrite(buffer,strlen(buffer),1,fp);
  631.         strcpy(buffer,itoa(i,I,10));
  632.         fwrite(buffer,strlen(buffer),1,fp);
  633.         strcpy(buffer,"].init(");
  634.         fwrite(buffer,strlen(buffer),1,fp);
  635.         strcpy(buffer,(itoa(line_info[i].Getx(),ULX,10)));
  636.         fwrite(buffer,strlen(buffer),1,fp);
  637.         strcpy(buffer,",");
  638.         fwrite(buffer,strlen(buffer),1,fp);
  639.         strcpy(buffer,(itoa(line_info[i].Gety(),ULY,10)));
  640.         fwrite(buffer,strlen(buffer),1,fp);
  641.         strcpy(buffer,",");
  642.         fwrite(buffer,strlen(buffer),1,fp);
  643.         strcpy(buffer,(itoa(line_info[i].Getx2(),LRX,10)));
  644.         fwrite(buffer,strlen(buffer),1,fp);
  645.         strcpy(buffer,",");
  646.         fwrite(buffer,strlen(buffer),1,fp);
  647.         strcpy(buffer,(itoa(line_info[i].Gety2(),LRY,10)));
  648.         fwrite(buffer,strlen(buffer),1,fp);
  649.         strcpy(buffer,",");
  650.         fwrite(buffer,strlen(buffer),1,fp);
  651.         strcpy(buffer,(itoa(line_info[i].Getcolor(),COL,10)));
  652.         fwrite(buffer,strlen(buffer),1,fp);
  653.         strcpy(buffer,",");
  654.         fwrite(buffer,strlen(buffer),1,fp);
  655.         strcpy(buffer,(itoa(line_info[i].Getstyle(),THICKNESS,10)));
  656.         fwrite(buffer,strlen(buffer),1,fp);
  657.         strcpy(buffer,");\n");
  658.         fwrite(buffer,strlen(buffer),1,fp);
  659.         }
  660.  
  661. //WRITE SHOW
  662.     strcpy(buffer,"for(int numlines=0;numlines<");
  663.     fwrite(buffer,strlen(buffer),1,fp);
  664.     strcpy(buffer,itoa(numlines,NL,10));
  665.     fwrite(buffer,strlen(buffer),1,fp);
  666.     strcpy(buffer,";numlines++)\n\tlines[numlines].show();");
  667.     fwrite(buffer,strlen(buffer),1,fp);
  668.     }
  669.  
  670.     fclose(fp);
  671.  
  672. //**************************************************************************
  673. //        SECOND PORTION OF THIS FILE SAVES THE CFG FILE FOR RETRIEVING
  674. //**************************************************************************
  675.     int *counts;
  676.     counts=new int;
  677.     fp=fopen(scrname,"wb");
  678.     if(!fp)
  679.         return 0;
  680.  
  681. bevelstruct bs;
  682. //write the number of bevels to the file
  683.     *counts=numbevels;
  684.     fwrite(counts,sizeof(int),1,fp);
  685.  
  686. //write all the bevel info to the file
  687.     if(bevelroot==(bevelrec *)NULL)
  688.         goto writepanels;
  689.     currentbevel=bevelroot;
  690.     while(currentbevel!=(bevelrec *)NULL) {
  691.         strcpy(bs.name,currentbevel->name);
  692.         bs.ulx=currentbevel->bevel->Getx();
  693.         bs.uly=currentbevel->bevel->Gety();
  694.         bs.w=currentbevel->bevel->Getw();
  695.         bs.h=currentbevel->bevel->Geth();
  696.         bs.thick=currentbevel->bevel->Getthick();
  697.  
  698.         fwrite(&bs,sizeof(bevelstruct),1,fp);
  699.         currentbevel=currentbevel->next;
  700.         }
  701.  
  702. writepanels:
  703. panelstruct ps;
  704. //write the number of panels to the file
  705.     *counts=numpanels;
  706.     fwrite(counts,sizeof(int),1,fp);
  707.  
  708. //write all the panel info to the file
  709.     if(panelroot==(panelrec *)NULL)
  710.         goto writebuttons;
  711.     currentpanel=panelroot;
  712.     while(currentpanel!=(panelrec *)NULL) {
  713.         strcpy(ps.name,currentpanel->name);
  714.         ps.ulx=currentpanel->panel->Getx();
  715.         ps.uly=currentpanel->panel->Gety();
  716.         ps.w=currentpanel->panel->Getw();
  717.         ps.h=currentpanel->panel->Geth();
  718.         ps.in=currentpanel->panel->Getin();
  719.         ps.thick=currentpanel->panel->Getthick();
  720.  
  721.         fwrite(&ps,sizeof(panelstruct),1,fp);
  722.         currentpanel=currentpanel->next;
  723.         }
  724.  
  725. writebuttons:
  726. buttonstruct btns;
  727. //write the number of buttons to the file
  728.     *counts=numbuttons;
  729.     fwrite(counts,sizeof(int),1,fp);
  730.  
  731. //write all the button info to the file
  732.     if(buttonroot==NULL)
  733.         goto writeicons;
  734.     currentbutton=buttonroot;
  735.     while(currentbutton!=NULL) {
  736.         strcpy(btns.name,currentbutton->name);
  737.         btns.ulx=currentbutton->button->Getx();
  738.         btns.uly=currentbutton->button->Gety();
  739.         strcpy(btns.cont,currentbutton->button->Getcontents());
  740.         btns.img=currentbutton->button->Getformat();
  741.  
  742.         fwrite(&btns,sizeof(buttonstruct),1,fp);
  743.         currentbutton=currentbutton->next;
  744.         }
  745.  
  746. writeicons:
  747. iconstruct is;
  748. //write the number of icons to the file
  749.     *counts=numicons;
  750.     fwrite(counts,sizeof(int),1,fp);
  751.  
  752. //write all the icon info to the file
  753.     if(iconroot==NULL)
  754.         goto writegstrings;
  755.     currenticon=iconroot;
  756.     while(currenticon!=NULL) {
  757.         strcpy(is.name,currenticon->name);
  758.         is.ulx=currenticon->icon->Getx();
  759.         is.uly=currenticon->icon->Gety();
  760.         strcpy(is.cont,currenticon->icon->Getfilename());
  761.  
  762.         fwrite(&is,sizeof(iconstruct),1,fp);
  763.         currenticon=currenticon->next;
  764.         }
  765.  
  766. writegstrings:
  767. gstringstruct gs;
  768. //write the number of gstrings to the file
  769.     *counts=numstrings;
  770.     fwrite(counts,sizeof(int),1,fp);
  771.  
  772. //write all the gstring info to the file
  773.     if(stringroot==NULL)
  774.         goto writeradios;
  775.     currentstring=stringroot;
  776.     while(currentstring!=NULL) {
  777.         strcpy(gs.name,currentstring->name);
  778.         gs.ulx=currentstring->string->Getx();
  779.         gs.uly=currentstring->string->Gety();
  780.         gs.length=currentstring->string->Getlength();
  781.         gs.uc=currentstring->string->is_ucase();
  782.  
  783.         fwrite(&gs,sizeof(gstringstruct),1,fp);
  784.         currentstring=currentstring->next;
  785.         }
  786.  
  787. writeradios:
  788. radiostruct rs;
  789. //write the number of radios to the file
  790.     *counts=numradios;
  791.     fwrite(counts,sizeof(int),1,fp);
  792.  
  793. //write all the radio info to the file
  794.     if(radioroot==NULL)
  795.         goto writecheckboxes;
  796.     currentradio=radioroot;
  797.     while(currentradio!=NULL) {
  798.         strcpy(rs.name,currentradio->name);
  799.         rs.ulx=currentradio->radio->Getx();
  800.         rs.uly=currentradio->radio->Gety();
  801.         strcpy(rs.cont,currentradio->radio->Gettext());
  802.  
  803.         fwrite(&rs,sizeof(radiostruct),1,fp);
  804.         currentradio=currentradio->next;
  805.         }
  806.  
  807. writecheckboxes:
  808. checkboxstruct cs;
  809. //write the number of checkboxes to the file
  810.     *counts=numcheckboxes;
  811.     fwrite(counts,sizeof(int),1,fp);
  812.  
  813. //write all the checkbox info to the file
  814.     if(checkboxroot==NULL)
  815.         goto writelines;
  816.     currentcheckbox=checkboxroot;
  817.     while(currentcheckbox!=NULL) {
  818.         strcpy(cs.name,currentcheckbox->name);
  819.         cs.ulx=currentcheckbox->checkbox->Getx();
  820.         cs.uly=currentcheckbox->checkbox->Gety();
  821.         strcpy(cs.cont,currentcheckbox->checkbox->Gettext());
  822.  
  823.         fwrite(&cs,sizeof(checkboxstruct),1,fp);
  824.         currentcheckbox=currentcheckbox->next;
  825.         }
  826.  
  827. writelines:
  828. linestruct ls;
  829. //write the number of lines to the file
  830.     *counts=numlines;
  831.     fwrite(counts,sizeof(int),1,fp);
  832.  
  833. //write all the line onfo to the file
  834.     for(i=0;i<numlines;i++) {
  835.         ls.x=line_info[i].Getx();
  836.         ls.y=line_info[i].Gety();
  837.         ls.x1=line_info[i].Getx2();
  838.         ls.y1=line_info[i].Gety2();
  839.         ls.color=line_info[i].Getcolor();
  840.         ls.thickness=line_info[i].Getstyle();
  841.  
  842.         fwrite(&ls,sizeof(linestruct),1,fp);
  843.         }
  844.  
  845. writegtexts:
  846. textstruct ts;
  847. //write the number of texts to the file
  848.     *counts=numtexts;
  849.     fwrite(counts,sizeof(int),1,fp);
  850.  
  851. //write all the text info to the file
  852.     if(textroot==NULL)
  853.         goto cleanup;
  854.     currenttext=textroot;
  855.     while(currenttext!=NULL) {
  856.         strcpy(ts.name,currenttext->name);
  857.         ts.ulx=currenttext->text->Getx();
  858.         ts.uly=currenttext->text->Gety();
  859.         strcpy(ts.cont,currenttext->text->Gettext());
  860.         ts.fgd=currenttext->text->Getfgd();
  861.         ts.bgd=currenttext->text->Getbgd();
  862.         ts.size=currenttext->text->Getsize();
  863.  
  864.         fwrite(&ts,sizeof(textstruct),1,fp);
  865.         currenttext=currenttext->next;
  866.         }
  867.  
  868. cleanup:
  869.     fclose(fp);
  870.     delete counts;
  871.     redraw_screen();
  872.     return 1;
  873. }
  874.  
  875. //**************************************************************************
  876. //        READ_NEW_INFO
  877. //**************************************************************************
  878.  
  879. int read_new_info()
  880. {
  881.     int i,num_objects;
  882.     FILE *fp;
  883.     char scrname[MAXPATH];
  884.     char filename[MAXPATH];
  885.     dirbox far *db;
  886.  
  887.     db=new dirbox;
  888.     db->set_mask("*.scr");
  889.     strcpy(filename,db->trackdir());
  890.     delete db;
  891.  
  892.     for(i=0;i<strlen(filename);i++)
  893.         if(filename[i]=='.') {
  894.             filename[i]=0;
  895.             break;
  896.             }
  897.     strcpy(scrname,filename);
  898.     strcat(scrname,".scr");
  899.     if(!(access(scrname,0))==0) {
  900.         printf("\a");
  901.         if((Messagebox("No Such File!",MB_CANCEL))==ID_CANCEL)
  902.             return 0;
  903.         }
  904.     fp=fopen(scrname,"rb");
  905.     if(!fp)
  906.         return 0;
  907.  
  908.     clear_all_info(FALSE);
  909.  
  910. //read numbevels and all bevel info
  911.     fread(&numbevels,sizeof(int),1,fp);
  912.  
  913.     bevelstruct bs;
  914.     for(i=0;i<numbevels;i++) {
  915.         if(bevelroot==(bevelrec *)NULL) {
  916.             bevelroot=new bevelrec;
  917.             bevelroot->previous=bevelroot->next=(bevelrec *)NULL;
  918.             bevelroot->bevel=new Bevel;
  919.             currentbevel=bevelroot;
  920.             }
  921.         else {
  922.             currentbevel=bevelroot;
  923.             while(currentbevel->next!=(bevelrec *)NULL)
  924.                 currentbevel=currentbevel->next;
  925.             currentbevel->next=new bevelrec;
  926.             currentbevel->next->bevel=new Bevel;
  927.             currentbevel->next->next=(bevelrec *)NULL;
  928.             currentbevel->next->previous=currentbevel;
  929.             currentbevel=currentbevel->next;
  930.             }
  931.         fread(&bs,sizeof(bevelstruct),1,fp);
  932.         strcpy(currentbevel->name,bs.name);
  933.         currentbevel->bevel->init(bs.ulx,bs.uly,bs.w,bs.h,bs.thick,SAVEBGD);
  934.         }
  935.  
  936.     fread(&numpanels,sizeof(int),1,fp);
  937.  
  938.     panelstruct ps;
  939.     for(i=0;i<numpanels;i++) {
  940.         if(panelroot==(panelrec *)NULL) {
  941.             panelroot=new panelrec;
  942.             panelroot->previous=panelroot->next=(panelrec *)NULL;
  943.             panelroot->panel=new Panel;
  944.             currentpanel=panelroot;
  945.             }
  946.         else {
  947.             currentpanel=panelroot;
  948.             while(currentpanel->next!=(panelrec *)NULL)
  949.                 currentpanel=currentpanel->next;
  950.             currentpanel->next=new panelrec;
  951.             currentpanel->next->panel=new Panel;
  952.             currentpanel->next->next=(panelrec *)NULL;
  953.             currentpanel->next->previous=currentpanel;
  954.             currentpanel=currentpanel->next;
  955.             }
  956.         fread(&ps,sizeof(panelstruct),1,fp);
  957.         strcpy(currentpanel->name,ps.name);
  958.         currentpanel->panel->init(ps.ulx,ps.uly,ps.w,ps.h,ps.in,ps.thick,SAVEBGD);
  959.         }
  960.  
  961.     fread(&numbuttons,sizeof(int),1,fp);
  962.  
  963.     buttonstruct btns;
  964.     for(i=0;i<numbuttons;i++) {
  965.         if(buttonroot==(buttonrec *)NULL) {
  966.             buttonroot=new buttonrec;
  967.             buttonroot->previous=buttonroot->next=(buttonrec *)NULL;
  968.             buttonroot->button=new Button;
  969.             currentbutton=buttonroot;
  970.             }
  971.         else {
  972.             currentbutton=buttonroot;
  973.             while(currentbutton->next!=(buttonrec *)NULL)
  974.                 currentbutton=currentbutton->next;
  975.             currentbutton->next=new buttonrec;
  976.             currentbutton->next->button=new Button;
  977.             currentbutton->next->next=(buttonrec *)NULL;
  978.             currentbutton->next->previous=currentbutton;
  979.             currentbutton=currentbutton->next;
  980.             }
  981.  
  982.         fread(&btns,sizeof(buttonstruct),1,fp);
  983.         strcpy(currentbutton->name,btns.name);
  984.         currentbutton->button->init(btns.ulx,btns.uly,btns.cont,btns.img,SAVEBGD);
  985.         }
  986.  
  987.     fread(&numicons,sizeof(int),1,fp);
  988.  
  989.     iconstruct is;
  990.     for(i=0;i<numicons;i++) {
  991.         if(iconroot==(iconrec *)NULL) {
  992.             iconroot=new iconrec;
  993.             iconroot->previous=iconroot->next=(iconrec *)NULL;
  994.             iconroot->icon=new Icon;
  995.             currenticon=iconroot;
  996.             }
  997.         else {
  998.             currenticon=iconroot;
  999.             while(currenticon->next!=(iconrec *)NULL)
  1000.                 currenticon=currenticon->next;
  1001.             currenticon->next=new iconrec;
  1002.             currenticon->next->icon=new Icon;
  1003.             currenticon->next->next=(iconrec *)NULL;
  1004.             currenticon->next->previous=currenticon;
  1005.             currenticon=currenticon->next;
  1006.             }
  1007.         fread(&is,sizeof(iconstruct),1,fp);
  1008.         strcpy(currenticon->name,is.name);
  1009.         currenticon->icon->init(is.ulx,is.uly,is.cont,SAVEBGD);
  1010.         }
  1011.  
  1012.     fread(&numstrings,sizeof(int),1,fp);
  1013.  
  1014.     gstringstruct gs;
  1015.     for(i=0;i<numstrings;i++) {
  1016.         if(stringroot==(stringrec *)NULL) {
  1017.             stringroot=new stringrec;
  1018.             stringroot->previous=stringroot->next=(stringrec *)NULL;
  1019.             stringroot->string=new Gstring;
  1020.             currentstring=stringroot;
  1021.             }
  1022.         else {
  1023.             currentstring=stringroot;
  1024.             while(currentstring->next!=(stringrec *)NULL)
  1025.                 currentstring=currentstring->next;
  1026.             currentstring->next=new stringrec;
  1027.             currentstring->next->string=new Gstring;
  1028.             currentstring->next->next=(stringrec *)NULL;
  1029.             currentstring->next->previous=currentstring;
  1030.             currentstring=currentstring->next;
  1031.             }
  1032.  
  1033.         fread(&gs,sizeof(gstringstruct),1,fp);
  1034.         strcpy(currentstring->name,gs.name);
  1035.         currentstring->string->init(gs.ulx,gs.uly,gs.length,gs.uc,SAVEBGD);
  1036.         }
  1037.  
  1038.     fread(&numradios,sizeof(int),1,fp);
  1039.  
  1040.     radiostruct rs;
  1041.     for(i=0;i<numradios;i++) {
  1042.         if(radioroot==(radiorec *)NULL) {
  1043.             radioroot=new radiorec;
  1044.             radioroot->previous=radioroot->next=(radiorec *)NULL;
  1045.             radioroot->radio=new Gradio;
  1046.             currentradio=radioroot;
  1047.             }
  1048.         else {
  1049.             currentradio=radioroot;
  1050.             while(currentradio->next!=(radiorec *)NULL)
  1051.                 currentradio=currentradio->next;
  1052.             currentradio->next=new radiorec;
  1053.             currentradio->next->radio=new Gradio;
  1054.             currentradio->next->next=(radiorec *)NULL;
  1055.             currentradio->next->previous=currentradio;
  1056.             currentradio=currentradio->next;
  1057.             }
  1058.  
  1059.         fread(&rs,sizeof(radiostruct),1,fp);
  1060.         strcpy(currentradio->name,rs.name);
  1061.         currentradio->radio->init(rs.ulx,rs.uly,rs.cont,SAVEBGD);
  1062.         }
  1063.  
  1064.     fread(&numcheckboxes,sizeof(int),1,fp);
  1065.  
  1066.     checkboxstruct cs;
  1067.     for(i=0;i<numcheckboxes;i++) {
  1068.         if(checkboxroot==(checkboxrec *)NULL) {
  1069.             checkboxroot=new checkboxrec;
  1070.             checkboxroot->previous=checkboxroot->next=(checkboxrec *)NULL;
  1071.             checkboxroot->checkbox=new Gcheckbox;
  1072.             currentcheckbox=checkboxroot;
  1073.             }
  1074.         else {
  1075.             currentcheckbox=checkboxroot;
  1076.             while(currentcheckbox->next!=(checkboxrec *)NULL)
  1077.                 currentcheckbox=currentcheckbox->next;
  1078.             currentcheckbox->next=new checkboxrec;
  1079.             currentcheckbox->next->checkbox=new Gcheckbox;
  1080.             currentcheckbox->next->next=(checkboxrec *)NULL;
  1081.             currentcheckbox->next->previous=currentcheckbox;
  1082.             currentcheckbox=currentcheckbox->next;
  1083.             }
  1084.         fread(&cs,sizeof(checkboxstruct),1,fp);
  1085.         strcpy(currentcheckbox->name,cs.name);
  1086.         currentcheckbox->checkbox->init(cs.ulx,cs.uly,cs.cont,SAVEBGD);
  1087.         }
  1088.  
  1089.     fread(&numlines,sizeof(int),1,fp);
  1090.  
  1091.     linestruct ls;
  1092.     for(i=0;i<numlines;i++) {
  1093.         fread(&ls,sizeof(linestruct),1,fp);
  1094.         line_info[i].init(ls.x,ls.y,ls.x1,ls.y1,ls.color,ls.thickness);
  1095.         }
  1096.  
  1097.     fread(&numtexts,sizeof(int),1,fp);
  1098.  
  1099.     textstruct ts;
  1100.     for(i=0;i<numtexts;i++) {
  1101.         if(textroot==(textrec *)NULL) {
  1102.             textroot=new textrec;
  1103.             textroot->previous=textroot->next=(textrec *)NULL;
  1104.             textroot->text=new Gtext;
  1105.             currenttext=textroot;
  1106.             }
  1107.         else {
  1108.             currenttext=textroot;
  1109.             while(currenttext->next!=(textrec *)NULL)
  1110.                 currenttext=currenttext->next;
  1111.             currenttext->next=new textrec;
  1112.             currenttext->next->text=new Gtext;
  1113.             currenttext->next->next=(textrec *)NULL;
  1114.             currenttext->next->previous=currenttext;
  1115.             currenttext=currenttext->next;
  1116.             }
  1117.  
  1118.         fread(&ts,sizeof(textstruct),1,fp);
  1119.         strcpy(currenttext->name,ts.name);
  1120.         currenttext->text->init(ts.ulx,ts.uly,ts.cont,ts.fgd,ts.bgd,ts.size,SAVEBGD);
  1121.         }
  1122.  
  1123.     fclose(fp);
  1124.     redraw_screen();
  1125.     return 1;
  1126. }
  1127.  
  1128. //**************************************************************************
  1129. //        CLEAR_ALL_INFO
  1130. //**************************************************************************
  1131.  
  1132. void clear_all_info(int erase_bgd)
  1133. {
  1134.     int i;
  1135.  
  1136. //delete bevels
  1137.     if(bevelroot!=(bevelrec *)NULL) {
  1138.         currentbevel=bevelroot;
  1139.         //find the end of the list
  1140.         while(currentbevel->next!=(bevelrec *)NULL)
  1141.             currentbevel=currentbevel->next;
  1142.         //back up through list deleteing the next record
  1143.         while(currentbevel->previous!=(bevelrec *)NULL) {
  1144.             currentbevel=currentbevel->previous;
  1145.             //delete the end
  1146.             currentbevel->next->bevel->elim();
  1147.             delete(currentbevel->next->bevel);
  1148.             delete(currentbevel->next);
  1149.             currentbevel->next=(bevelrec *)NULL;
  1150.             }
  1151.         //delete the root
  1152.         bevelroot->bevel->elim();
  1153.         delete(bevelroot->bevel);
  1154.         delete(bevelroot);
  1155.         bevelroot=(bevelrec *)NULL;
  1156.         }
  1157.  
  1158. //delete panels
  1159.     if(panelroot!=(panelrec *)NULL) {
  1160.         currentpanel=panelroot;
  1161.         //find the end of the list
  1162.         while(currentpanel->next!=(panelrec *)NULL)
  1163.             currentpanel=currentpanel->next;
  1164.         //back up through list deleteing the next record
  1165.         while(currentpanel->previous!=(panelrec *)NULL) {
  1166.             currentpanel=currentpanel->previous;
  1167.             //delete the end
  1168.             currentpanel->next->panel->elim();
  1169.             delete(currentpanel->next->panel);
  1170.             delete(currentpanel->next);
  1171.             currentpanel->next=(panelrec *)NULL;
  1172.             }
  1173.         //delete the root
  1174.         panelroot->panel->elim();
  1175.         delete(panelroot->panel);
  1176.         delete(panelroot);
  1177.         panelroot=(panelrec *)NULL;
  1178.         }
  1179.  
  1180. //delete buttons
  1181.     if(buttonroot!=(buttonrec *)NULL) {
  1182.         currentbutton=buttonroot;
  1183.         //find the end of the list
  1184.         while(currentbutton->next!=(buttonrec *)NULL)
  1185.             currentbutton=currentbutton->next;
  1186.         //back up through list deleteing the next record
  1187.         while(currentbutton->previous!=(buttonrec *)NULL) {
  1188.             currentbutton=currentbutton->previous;
  1189.             //delete the end
  1190.             currentbutton->next->button->elim();
  1191.             delete(currentbutton->next->button);
  1192.             delete(currentbutton->next);
  1193.             currentbutton->next=(buttonrec *)NULL;
  1194.             }
  1195.         //delete the root
  1196.         buttonroot->button->elim();
  1197.         delete(buttonroot->button);
  1198.         delete(buttonroot);
  1199.         buttonroot=(buttonrec *)NULL;
  1200.         }
  1201.  
  1202. //delete icons
  1203.     if(iconroot!=(iconrec *)NULL) {
  1204.         currenticon=iconroot;
  1205.         //find the end of the list
  1206.         while(currenticon->next!=(iconrec *)NULL)
  1207.             currenticon=currenticon->next;
  1208.         //back up through list deleteing the next record
  1209.         while(currenticon->previous!=(iconrec *)NULL) {
  1210.             currenticon=currenticon->previous;
  1211.             //delete the end
  1212.             currenticon->next->icon->elim();
  1213.             delete(currenticon->next->icon);
  1214.             delete(currenticon->next);
  1215.             currenticon->next=(iconrec *)NULL;
  1216.             }
  1217.         //delete the root
  1218.         iconroot->icon->elim();
  1219.         delete(iconroot->icon);
  1220.         delete(iconroot);
  1221.         iconroot=(iconrec *)NULL;
  1222.         }
  1223.  
  1224. //delete radios
  1225.     if(radioroot!=(radiorec *)NULL) {
  1226.         currentradio=radioroot;
  1227.         //find the end of the list
  1228.         while(currentradio->next!=(radiorec *)NULL)
  1229.             currentradio=currentradio->next;
  1230.         //back up through list deleteing the next record
  1231.         while(currentradio->previous!=(radiorec *)NULL) {
  1232.             currentradio=currentradio->previous;
  1233.             //delete the end
  1234.             currentradio->next->radio->elim();
  1235.             delete(currentradio->next->radio);
  1236.             delete(currentradio->next);
  1237.             currentradio->next=(radiorec *)NULL;
  1238.             }
  1239.         //delete the root
  1240.         radioroot->radio->elim();
  1241.         delete(radioroot->radio);
  1242.         delete(radioroot);
  1243.         radioroot=(radiorec *)NULL;
  1244.         }
  1245.  
  1246. //delete checkboxes
  1247.     if(checkboxroot!=(checkboxrec *)NULL) {
  1248.         currentcheckbox=checkboxroot;
  1249.         //find the end of the list
  1250.         while(currentcheckbox->next!=(checkboxrec *)NULL)
  1251.             currentcheckbox=currentcheckbox->next;
  1252.         //back up through list deleteing the next record
  1253.         while(currentcheckbox->previous!=(checkboxrec *)NULL) {
  1254.             currentcheckbox=currentcheckbox->previous;
  1255.             //delete the end
  1256.             currentcheckbox->next->checkbox->elim();
  1257.             delete(currentcheckbox->next->checkbox);
  1258.             delete(currentcheckbox->next);
  1259.             currentcheckbox->next=(checkboxrec *)NULL;
  1260.             }
  1261.         //delete the root
  1262.         checkboxroot->checkbox->elim();
  1263.         delete(checkboxroot->checkbox);
  1264.         delete(checkboxroot);
  1265.         checkboxroot=(checkboxrec *)NULL;
  1266.         }
  1267.  
  1268. //delete gtexts
  1269.     if(textroot!=(textrec *)NULL) {
  1270.         currenttext=textroot;
  1271.         //find the end of the list
  1272.         while(currenttext->next!=(textrec *)NULL)
  1273.             currenttext=currenttext->next;
  1274.         //back up through list deleteing the next record
  1275.         while(currenttext->previous!=(textrec *)NULL) {
  1276.             currenttext=currenttext->previous;
  1277.             //delete the end
  1278.             currenttext->next->text->elim();
  1279.             delete(currenttext->next->text);
  1280.             delete(currenttext->next);
  1281.             currenttext->next=(textrec *)NULL;
  1282.             }
  1283.         //delete the root
  1284.         textroot->text->elim();
  1285.         delete(textroot->text);
  1286.         delete(textroot);
  1287.         textroot=(textrec *)NULL;
  1288.         }
  1289.  
  1290. //delete gstrings
  1291.     if(stringroot!=(stringrec *)NULL) {
  1292.         currentstring=stringroot;
  1293.         //find the end of the list
  1294.         while(currentstring->next!=(stringrec *)NULL)
  1295.             currentstring=currentstring->next;
  1296.         //back up through list deleteing the next record
  1297.         while(currentstring->previous!=(stringrec *)NULL) {
  1298.             currentstring=currentstring->previous;
  1299.             //delete the end
  1300.             currentstring->next->string->elim();
  1301.             delete(currentstring->next->string);
  1302.             delete(currentstring->next);
  1303.             currentstring->next=(stringrec *)NULL;
  1304.             }
  1305.         //delete the root
  1306.         stringroot->string->elim();
  1307.         delete(stringroot->string);
  1308.         delete(stringroot);
  1309.         stringroot=(stringrec *)NULL;
  1310.         }
  1311.  
  1312.     numbevels=0;
  1313.     numpanels=0;
  1314.     numbuttons=0;
  1315.     numicons=0;
  1316.     numradios=0;
  1317.     numcheckboxes=0;
  1318.     numtexts=0;
  1319.     numstrings=0;
  1320.     numlines=0;
  1321.  
  1322.     if(erase_bgd)
  1323.         redraw_screen();
  1324. }